package the.workshop.tms.goods.dto;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import the.workshop.tms.goods.entity.Goods;

import java.util.List;

@Data
public class GoodsDTO {
    private Long id;
    private String name;
    private String quantity;
    private String weight;
    private List<String> imageList;

    public Goods toGoods() {
        Goods entity = new Goods();
        BeanUtils.copyProperties(this, entity);
        entity.setImageData(JSON.toJSONString(imageList));
        return entity;
    }
}
